package com.sc.VenusQueryBeta.adapter.home;

import android.support.annotation.Nullable;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.chad.library.adapter.base.BaseViewHolder;

import com.sc.VenusQueryBeta.R;
import com.sc.VenusQueryBeta.adapter.BaseCompatAdapter;
import com.sc.VenusQueryBeta.api.Host;
import com.sc.VenusQueryBeta.model.bean.home.HotelRestaurantBean;

import java.util.List;

/**
 * Created by Administrator on 2018/10/11.
 *
 */

public class RestaurantAdapter extends BaseCompatAdapter<HotelRestaurantBean.DataBean,BaseViewHolder> {
    private ImageView imageView;
    public RestaurantAdapter(int layoutResId, @Nullable List<HotelRestaurantBean.DataBean> data) {
        super(layoutResId, data);
    }

    public RestaurantAdapter(int item_restaurant) {
        super(item_restaurant);
    }

    @Override
    protected void convert(BaseViewHolder helper, HotelRestaurantBean.DataBean item) {
                    helper.setText(R.id.hotel_name,item.getHotelName());
                    helper.setText(R.id.hotel_adress,item.getLocationTag());
                    helper.setText(R.id.hotel_phone,item.getOrderTel());
                    //動態加載酒店圖片
         imageView =helper.getView(R.id.hotel_img);
        Glide.with(mContext).load(Host.HostImg+item.getHotelLogoUrl()).diskCacheStrategy(DiskCacheStrategy.SOURCE).centerCrop().placeholder(R.drawable.load_error).into(imageView);

    }
}
